package com.lwj.liwanjia.view.activity.login;

import android.view.View;
import android.widget.TextView;

import com.lwj.liwanjia.R;
import com.lwj.liwanjia.base.BaseActivity;

/**
 * Created by 001 on 2017/9/5.
 */

public class ForgetChangeActivity extends BaseActivity implements View.OnClickListener {

    private TextView tv_title;//头布局标题
    private TextView tv_back;//头布局左边的返回按钮
    private TextView tv_phone;//手机号码

    @Override
    protected void initView() {

        tv_title = (TextView) findViewById(R.id.tv_title);
        tv_back = (TextView) findViewById(R.id.tv_left);
        tv_phone = (TextView) findViewById(R.id.tv_phone);

        tv_back.setOnClickListener(this);

        //初始化UI
        tv_back.setText("返回");
        tv_back.setVisibility(View.VISIBLE);
        tv_title.setText("换绑手机");

    }

    @Override
    protected void initData() {

        //TO:从ForgetActivity接收手机号码
        //String phoneNumber = getIntent();

        //隐藏手机号码中间几位
        String phoneNumber = "18767793269";
        String phoneFirst = phoneNumber.substring(0, 3);
        String phoneEnd = phoneNumber.substring(phoneFirst.length()+4, phoneNumber.length());
        String phoneNew = phoneFirst +"****"+ phoneEnd;
        String resultPhone = "短信验证码已发送到绑定手机"+phoneNew;
        tv_phone.setText(resultPhone);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_forget_change;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            //返回键
            case R.id.tv_left:
                finish();
                break;
        }
    }
}
